#ifndef ISERIALIZABLE_HPP_
# define ISERIALIZABLE_HPP_

# include <string>

namespace utils {

/*! Represent a serializable object */
class ISerializable {
public:
  /*! Destructor */
  virtual ~ISerializable() {
  }

  /*! Serialize the object
   * \return a std::string representing the serialized data
   */
  virtual std::string Serialize() const = 0;
  /*! Deserialize the object
   * \param data : data to deserialize
   */
  virtual void Deserialize(const std::string &data) = 0;
  /*! Get size of serialized data
   * \return size of serialized data
   */
  virtual size_t GetSerializedSize() const = 0;
};

} /* !namespace utils */

/*! Operator shift-left overload, used to serialize a \a ISerializable object
 *  and write data in a std::ostream.
 */
std::ostream &operator<<(std::ostream &out, const utils::ISerializable &object);
/*! Operator shift-rifht overload, used to deserialize a \a ISerializable
 *  object from a std::istream
 */
std::istream &operator>>(std::istream &in, utils::ISerializable &object);

#endif /* !ISERIALIZABLE_HPP_ */
